#pragma once
#include <iostream>
#include <string.h>

namespace zzn
{
    class LogLevel
    {
    public:
        enum class value
        {
            UNKNOWN = 0,
            DEBUG,
            INFO,
            WARN,
            ERROR,
            FATAL,
            OFF
        };

        // 把level数字转成字符串
        static const std::string ToString(LogLevel::value val)
        {
            switch (val)
            {
#define TOSTRING(name) #name // #用于字符串化
            case LogLevel::value::DEBUG:
                return TOSTRING(DEBUG);
                break;
            case LogLevel::value::INFO:
                return TOSTRING(INFO);
                break;
            case LogLevel::value::WARN:
                return TOSTRING(WARN);
                break;
            case LogLevel::value::ERROR:
                return TOSTRING(ERROR);
                break;
            case LogLevel::value::FATAL:
                return TOSTRING(FATAL);
                break;
            case LogLevel::value::OFF:
                return TOSTRING(OFF);
                break;
#undef TOSTRING

            default:
                return "UNKOWN";
                break;
            }
        }
    };
}

